import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

import Vue2Editor from 'vue2-editor'

Vue.use(Vue2Editor)
/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
// if (process.env.NODE_ENV === 'production') {
//   const { mockXHR } = require('../mock')
//   mockXHR()
// }

// 根据封装的组件模块使用整体注册
import myPlugin from '@/components/index'
// 当我们利用vue.use函数使用插件,就会自动调用
// myPlugin插件的install方法并给该方法传入Vue
Vue.use(myPlugin)

// set ElementUI lang to EN
Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)

// 全局指令
// 对图片报错的修改
import { imgerror, changTime } from '@/directives/index'
Vue.directive('imgerror', imgerror)
Vue.directive('changTime', changTime)

Vue.config.productionTip = false

// 引入混入对象

import mixin from '@/mixin/checkpermission'
Vue.mixin(mixin)
new Vue({
  el: '#app',
  // mixins: [mixin], // 全局引入错误
  router,
  store,
  render: h => h(App)
})
